//
//  ViewController.swift
//  RxSwiftExample
//
//  Created by lxf on 2021/11/23.
//

import UIKit
import RxSwift

class ViewController: BaseViewController {

    let bag = DisposeBag()
    
    lazy var button: UIButton = {
        let button = UIButton(type: .custom)
        button.setTitle("Push", for: .normal)
        button.setTitleColor(.blue, for: .normal)
        return button
    }()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        
        self.title = "ViewController"
        
    }

    
    override func initSubViews() {
        super.initSubViews()
        self.view.addSubview(button)
    }
    
    override func addConstraints() {
        super.addConstraints()
        button.snp.makeConstraints { make in
            make.top.equalTo(self.view)
            make.centerX.equalTo(self.view)
        }
    }
    
    override func addRxSwift() {
        super.addRxSwift()
        button.rx.tap.subscribe(onNext: { [weak self] in
            guard let _ = self else { return }
            
            debugPrint("button-tap-test")
            let vc = RxTableViewController()
//            let vc = RxViewController()
            
            self!.navigationController?.pushViewController(vc, animated: true)
            
        }).disposed(by: self.bag)
    }
    

}

